﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace PersistentObject.Common.Criteria
{
    /// <summary>
    /// Represent an BETWEEN clause
    /// </summary>
    public class BetweenCriteria : BaseCriteria
    {
        /// <summary>
        /// Indicate the A operand in the predicate A between B and C
        /// </summary>
        public Operand A { get; private set; }
        /// <summary>
        /// Indicate the B operand in the predicate A between B and C
        /// </summary>
        public Operand B { get; private set; }
        /// <summary>
        /// Indicate the C operand in the predicate A between B and C
        /// </summary>
        public Operand C { get; private set; }

        /// <summary>
        /// The constructor of BETWEEN criteria
        /// </summary>
        /// <param name="field">Indicate the FIELD operand</param>
        /// <param name="lbound">Indicate the LBOUND value operand</param>
        /// <param name="ubound">Indicate the UBOUND value operand</param>
        public BetweenCriteria(string field, object lbound, object ubound)
        {
            A = new OperandProperty(field);
            B = new OperandValue(lbound);
            C = new OperandValue(ubound);
        }

        /// <summary>
        /// The constructor of BETWEEN criteria
        /// </summary>
        /// <param name="value">Indicate the VALUE operand</param>
        /// <param name="left">Indicate the LEFT property operand</param>
        /// <param name="right">Indicate the RIGHT property operand</param>
        public BetweenCriteria(object value, string left, string right)
        {
            A = new OperandValue(value);
            B = new OperandProperty(left);
            C = new OperandProperty(right);
        }

        /// <summary>
        /// The constructor of BETWEEN criteria
        /// </summary>
        /// <param name="field">Indicate the FIELD operand</param>
        /// <param name="lbound">Indicate the LBOUND operand</param>
        /// <param name="ubound">Indicate the UBOUND operand</param>
        public BetweenCriteria(Operand field, Operand lbound, Operand ubound)
        {
            A = field;
            B = lbound;
            C = ubound;
        }
    }
}
